year = 2017
event = 'Referendum'
print(f"Results of the {year} {event}")

yes_votes= 42_572_654
no_votes = 43_132_394
percentage = yes_votes/(yes_votes+no_votes)*100
print(percentage)
print('{:9} yes votes {:2.2%}'.format(yes_votes,no_votes))
s = 'hello, world'
# str(s)
print(str(s))

print(repr(s))

print(str(1/7))
print("####"*30)
x = 10 * 3.25
y = 200 * 200
s = 'the value of x is  ' + repr(x) + ' , and y is '  + repr(y) + '...'
print(s)
hello = 'hello,world\n'
hellos = repr(hello)
print(hellos)

print(repr((x , y , ('spam' , 'eggs'))))

import math
print(f'the value of pi is approximately {math.pi:.3f}')

table = {'Sjoerd':1 , 'Jack':2 , 'Mill':3 }
for name , phone in table.items():
    print(f'{name:10} : {phone:10d}')

animals = 'eels'
print(f'My hovercraft is full of {animals}')

print(f'My hovercraft is full of {animals!r}')

bugs = 'roaches'
count  = 13
area = 'living room'
print(f'debugging {bugs=}  {count=}  {area=}')

print('we are the {} who say "{}!"'.format('knights' , 'Ni'))
print('{0} and {1}'.format('spam' , 'eggs'))
print('{1} and {0}'.format('spam' , 'eggs'))

print('this {food} is {adjective}.'.format(food='spam', adjective='eggs'))

print('the store of {0} , {1} , and {other}.'.format('bill' , 'manfred' ,  other='Georg'))

table = {'Sjoerd':1 , 'Jack':2 , 'Dcab':3}
print('jack:{0[Jack]:d} ; Sjoerd: {0[Sjoerd]:d} ; Dcab:{0[Dcab]:d}'.format(table))

table = {'s':1 , 'j':2 , 'd':3}
print('j:{j:d} ; s:{s:d} ; d:{d:d}'.format(**table))

for x in range(1,11):
    print('{0:2d} {1:3d} {2:4d}'.format(x , x*x , x**x))
for x in range(1,11):
    print(repr(x).rjust(2) , repr(x*x).rjust(3) , end=' ')
    print(repr(x*x*x).rjust(4))
print("^^^^"*20)
print('12'.zfill(3))
print('-2.32'.zfill(10))
print('1.2'.zfill(3))

print('the value of pi is approximately %5.5f.' % math.pi)
f = open('D:\\test\\1.txt'  , 'w' , encoding="utf-8")
print(f.name)
f.write("1234567890- \n")
f.writelines("0987654321")
f.close()
# f.writable()
s = []
with open('D:\\test\\1.txt') as f :
    s = f.readlines()

for str in s :
    print(str)
f.close()
print("==========")
f= open('D:\\test\\1.txt'  )
for line in f:
    print(line , end='')
# f.writelines("this is a test \n")
# value = ('the answer' , 42)
# s = str(value)
# f.writelines(s)
f.close()
#
# f = open('D:\\test\\1.txt' ,'rb+')
# f.writelines(b'qwertyuioasdfgh')
# f.seek(5)
# f.read(1)
# f.seek(-3,2)
# f.read(1)
# f.close()
print("000000000000000000")
import json
x = [1,'simple' , 'list']
jsonstr = json.dumps(x)
print(jsonstr[1])